﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

namespace Bonehead
{
    public class CalleeInfo
    {
        private ParsedMethod mMethod;
        private long mCallCount;
        private long mCycleCount;
        private long mMinCycleCount;
        private long mMaxCycleCount;

        public CalleeInfo(ParsedMethod aMethod, long aCycles)
        {
            mMethod = aMethod;
            mCallCount = 1;
            mCycleCount = aCycles;
            mMinCycleCount = aCycles;
            mMaxCycleCount = aCycles;
        }

        public string Name
        {
            get { return mMethod.Name; }
        }

        public long CallCount
        {
            get { return mCallCount; }
        }

        public long CycleCount
        {
            get { return mCycleCount; }
        }

        public long MinCycleCount
        {
            get { return mMinCycleCount; }
        }

        public long MaxCycleCount
        {
            get { return mMaxCycleCount; }
        }

        [Browsable(false)]
        public ParsedMethod Method
        {
            get { return mMethod; }
        }

        public void AddCall()
        {
            mCallCount++;
        }
        
        public void AddCycles(long aCycles)
        {
            mCycleCount += aCycles;
            mMinCycleCount = Math.Min(mMinCycleCount, aCycles);
            mMaxCycleCount = Math.Max(mMaxCycleCount, aCycles);
        }
    }
}
